﻿//------------------------------------------------------------------------------
// 创建标识: Copyright (C) 2008 Socansoft.com 版权所有
// 创建描述: SocanCode代码生成器自动创建于 2008-8-20 14:22:40
//
// 功能描述: 
//
// 修改标识: 
// 修改描述: 
//------------------------------------------------------------------------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public partial class Controls_DANWEIListControl : System.Web.UI.UserControl
{
    public event RepeaterCommandEventHandler ItemCommand;

    protected string GetUnitNature(string code)
    {
        switch (code)
        {
            case "0":
                return "其他单位";
                break;
            case "1":
                return "重量单位";
                break;
            case "2":
                return "长度单位";
                break;
            case "3":
                return "包装单位";
                break;
            case "4":
                return "面积单位";
                break;
            case "5":
                return "体积单位";
                break;
            case "":
                return "无数据";
                break;
        }
        return "";
    }
    public List<string> Selected
    {
        get
        {
            List<string> l = new List<string>();
            foreach (RepeaterItem item in rptDANWEI.Items)
            {
                CheckBox cb = item.FindControl("chkChoose") as CheckBox;
                if (cb != null && cb.Checked)
                {
                    HiddenField fld = item.FindControl("hfDANWEI") as HiddenField;
                    if (fld != null)
                    {
                        string id = fld.Value;
                        l.Add(id);
                    }
                }
            }
            return l;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public void Bind(List<Model.DANWEI> l)
    {
        rptDANWEI.DataSource = l;
        rptDANWEI.DataBind();
    }

    protected void rptDANWEI_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (ItemCommand != null)
            ItemCommand(source, e);
    }
}
